home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Geek Gadgets 2
/
Geek_Gadgets_2_2352.bin
/
lists
/
ade-gcc.archive.9602.gz
/
ade-gcc.archive.9602
/
000054_owner-ade-gcc_Wed Feb 14 06:28:17 1996.msg
< prev
next >
Wrap
Internet Message Format
|
1996-02-28
|
3KB
Return-Path: <owner-ade-gcc>
Received: by fishpond (Smail3.1.29.1 #57)
id m0tmfNK-000gYKa; Wed, 14 Feb 96 06:27 EST
Sender: owner-ade-gcc
Received: from ernie.icslab.agh.edu.pl by fishpond with smtp
(Smail3.1.29.1 #57) id m0tmfMS-000gXUC; Wed, 14 Feb 96 06:27 EST
Received: (from kiskra@localhost) by ernie.icslab.agh.edu.pl (8.6.12/8.6.12) id MAA13865; Wed, 14 Feb 1996 12:27:25 +0100
Date: Wed, 14 Feb 1996 12:27:25 +0100 (MET)
From: Kamil Iskra <kiskra@ernie.icslab.agh.edu.pl>
To: ADE GCC List <ade-gcc@amigalib.com>
cc: Amiga GCC List <amiga-gcc-port@nic.funet.fi>
Subject: Passing arguments in registers - first attempt.
Message-ID: <Pine.SUN.3.91.960214114852.12545A-100000@ernie>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Sender: owner-ade-gcc@amigalib.com
Precedence: bulk
I managed to implement passing arguments in registers using GCC 2.7.0. It
turned out to be very easy - GCC has full support for this.
As of now, it works like this:
By default GCC passes arguments on stack.
If you specify "-mregparm" argument, GCC passes two first integer
arguments in d0/d1 and two first pointers in a0/a1.
Currently this is not very useful, since IXEmul and Libnix do not support
this way of passing arguments. That's why I won't include patch in this
posting - it's too preliminary (however, patch is available on my WWW page
for those of you, who would like to see how it works. Pre-compiled cc1 is
available, as well).
I made a few simple tests and it seems that with optimisation turned off
GCC produces very poor code for passing arguments in registers - it
basically copies arguments from registers to stack on function entry.
However, with optimisation turned on, code quality improves.
I think that this posting should be the beginning of serious discussion
about details of passing arguments in registers.
I think that the most important things that should be addressed are:
1. How to distinguish register calls from stack calls (i.e. how linker
should distinguish them)?
2.a. What should be the exact way of passing arguments in registers?
2.b. Like I did it, ie. two first integers in d0/d1, two first pointers in
a0/a1, rest on stack?
2.c. Maybe we should use fp0/fp1 for floating point arguments?
2.d. Maybe there should be a default setting, which user can override by
specifieng "-mregparm=<number>", where number is (for example) amount of
register to use for each group of parameters (ie. 2 by default).
3. How should library calls be made? Should there be two entries for each
function in every library? But this will result in worse code for stack
calls than currently. And how to implement it in IXEmul?
4. I think that SAS/C compatible __stdargs and __regargs keywords should
be implemented. If the latter one was specified as GCC attribute, it would
be possible to provide <number> argument (see above), like this:
void func() __attribute__ ((regargs(3)));
Have I forgotten about something?
/ Kamil Iskra - AMIGA 1200, 68030 50MHz, HDD 850 MB, 10 MB RAM \
| iskra@student.uci.agh.edu.pl kiskra@ernie.icslab.agh.edu.pl |
| http://student.uci.agh.edu.pl/~iskra |
\ PGP public key available via Finger or WWW /